#include <iostream>
using namespace std;

class A{
public:
    int val;
    virtual void print()const{ cout << "A" << endl; }
};

class B : virtual A{
public:
    virtual void print()const{ cout << "B" << endl; }
};

class C : virtual public A, public B{
public:
    void print(){ 
        val = 10;
        cout << "C: " << val << endl; 
    }
};

int main()
{
    A *a = new A();
    B *b = new B();
    C *c = new C();
    
    a->print();
    b->print();
    c->print();

    //a->print();
    //((A*)b)->print();
    //((A*)c)->print();    
}